<?php
namespace app\controller;

use app\BaseController;
use think\facade\Db;

class CaptionController extends BaseController
{
    /**
     * 获取字幕样式列表
     */
    public function list()
    {
        try {
            $list = Db::name('caption_styles')
                ->where('status', 1)
                ->order('id', 'asc')
                ->select();

            return json([
                'code' => 200,
                'msg' => 'success',
                'data' => $list
            ]);
        } catch (\Exception $e) {
            \think\facade\Log::error('获取字幕样式列表失败', ['error' => $e->getMessage(), 'trace' => $e->getTraceAsString()]);
            return json([
                'code' => 500,
                'msg' => $e->getMessage(),
                'data' => null
            ]);
        }
    }
}
